#include "LogHandler.h"


LogHandler::LogHandler(const SocketStream * stream, Reactor * reactor)
  : reactor_(reactor), connection_(stream)
{
  reactor_->registerHandler(this, READ_EVENT);
}

void LogHandler::handleEvent (Handle h, EventType et)
{
  if (et == READ_EVENT)
    {
      std::string message = connection_->recv();

      std::cout << "Log message received:\n" << message << std::endl;
    }
}

Handle LogHandler::getHandle() const
{
  return connection_->getHandle();
}

